<?php

abstract class Resource_Block_Abstract extends Kernel_Block 
{
    
    public function entriesCnt() 
    {
        return count($this->_navigation());
    }
    
    public function active() 
    {
        return $this->_active();
    }
    
    /**
     * @desc Return template data. 
     *
     * @return  array
     */
    public function getData() 
    {
        return
            array(
                'entries' => $this->_navigation(), 
                'current' => $this->_active(), 
            );
    }
    
    /**
    * @desc Return navigation name.
    * 
    * @return string
    */
    protected function _name() 
    {
        $class_name = get_class($this);
        return substr($class_name, strrpos($class_name, '_') + 1);
    }
    
    /**
    * Return navigation.
    * 
    * @return array
    */
    abstract protected function _navigation();
    
    /**
    * Return active resource.
    * 
    * @return integer
    */
    abstract protected function _active();
    
}